<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title>Title</title>
</head>
<!--<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>-->
<!--<script src="https://cdn.staticfile.org/vue-resource/1.5.1/vue-resource.min.js"></script>-->
<script src="https://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
<body>
<!--    <form action="/secure/product/list" method="post">-->
<!--        <input type="text" name="code" value="AQABAAIAAADCoMpjJXrxTq9VG9te-7FX6KYGRBKCqxvVYF5eNdC7hSOSOgWjz8u_3IxSsnTNsrcvOE8q9Uo4cXatH9h_BjTslWxKezZk4awTz5DOy9QwPxP3YeGCf5YDkFb3hOVHQRuIleLtVRLJliuGwERwzs3sglXzJv1FtyfJxdoZBoFfl_lfV&#45;&#45;Dg-de_AVknZcX2yUjBJ0BktQRHbF_Er3T2H_URjs3gMY69jYwoCZP3usEoxVSs6F8_F663oZ84ttCQnxwBxFXy4q3JdpZAJ989cxcfP_OenIpYv3T2S7ioHbTpPpDQHgKS_1sM-k8wFn8tmbdcuxM8dFxFHcu2YYhq5-uy0szXtnN32tWWG9wjci-_LL_ap0v_7euDmKI3E0BDCYyAXAmRyAkR6wlSs1LoEPoG_qXovhRZckEikcpZ7w-nj2XUUzxH1Pcy7ysXIz2l73d1zUb1QZl6WlKymD7Flrigukny3V2vHkP5_NfEgRg9C3wT8JoJFlRW8zlZrmedqRr_vfug6TROIjz44i4RZjvQHoQ_m8woaN9b6qkGUBZJmr2BxEwCbkQ1OAtDeaWNASMEZWItWJJejqQkz6q7rIKFGJqqvZJWGNUVe2bPyXLyf9SGc_FbxtOynpNKDUeVuWKfRFeGJ33ibpn98YbqsNxawGayPJ8JsSFU2rvbA4TjbciQm-Rj0Dlbq0HjrQ&#45;&#45;wcT7tga6sQg5qdRI9Z7gx_FYTLXfOLYsmwTmijKv3aWrdq8NlAPiPv4GoWfPVcx3dJGi6-vGOL3VGOsnWkADLDhlaDJbIbswYEAM1diBBPwQBM3SB-IQZLiVZjkNZ3dLNlTT7I5wcJv53_BgbXXiEV_F_duxH3nf5kSTT29neieXQfKkmbzMDP2z80GvtGD6PTKvQZsD-uM0glkG2o4dQRtxx2QJ3fQAcXD1cUTmvxcdfugUaniQXAJQJaLEJRc-S7Z7JqlCUu1RT43gI7xT0M7LxLLdIGD0LGvYWGAi4ISwVoIDyIqsG2FV1vBQbzsQrY6sGsNEOdup7r11GDRcTSX5zSves9-obSZXG5MYXZjMQzZPh9-OYU8BTzjRF2r-9pjQT6kfUwFEDFXn4zHH9p7fIFkwOmQgDHbCGIN8L4nkVgZ1dBx12ZujT33vaG28n3rtfNqw1Bch2vQs2-OxRryiOmHzw8QwS_1Hyntr6Ki3azzZOFhHENzh7oaUpkzq4A2bTaKN4vzybj9EcrM7xkhCGgzpKgdb7Uia2lZpZ-jZCAA"/>-->
<!--        <input type="text" value="a6f99d92-d186-44e0-9771-ea541258402f" name="state"/>-->
<!--        <input type="text" value="ce28805f-4598-4f8d-9575-a16fb8587e13" name="session_state"/>-->
<!--        <button type="submit" value="提交">提交</button>-->
<!--    </form>-->
    <div  style="margin-left: 100px ;margin-top: 30px">
        <p>Welcome to Car Store</p>
        <table>
            <tbody>
                <tr><td><a href="/car/secure/product/list">View cars.</a></td></tr>
                <tr><td><a id="link-to-another-sys" href="https://www.luolineya.xyz/storefront/secure/product/list">Go to see some fruit.</a></td></tr>
<!--                <tr><td><a href="http://localhost:8080/storefront/secure/product">Go to see some fruit.</a></td></tr>-->
            </tbody>
        </table>
    </div>
<script>

    $(document).ready(function(){
        $.ajax({
            url:'/car/token/getAccessToken',
            type:'get',
            //dataType:'string',
            contentType:'text/plain',
            success:function(res){
                // console.log(res);
                var a = $('#link-to-another-sys')
                var href = a.attr('href');
                // console.log(href);
                a.attr('href',href+'?access_token='+res);
            },
            error:function(res){
                console.log(res);
            }
        });
    });

    // var vm = new Vue({
    //     el : '#link-to-another-sys',
    //     mounted: function (e) {
    //         this.$http.get('/car/token/getAccessToken').then(function(res){
    //             // console.log(e.target.getAttribute("href"));
    //             console.log(res.bodyText);
    //             $doc = document.getElementById("link-to-another-sys");
    //             $doc.href = $doc.href+"?access_token="+res.bodyText;
    //         },function(){
    //             console.log('请求失败处理');
    //         });
    //     }
    // })
</script>
</body>
</html>